package cn.xiaohuodui.dao;

import cn.xiaohuodui.form.back.admin.AdminBackDo;
import cn.xiaohuodui.model.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface AdminMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Admin record);

    int insertSelective(Admin record);

    Admin selectByPrimaryKey(Integer id);

    /**
     * 通过 username 获取 Admin
     *
     * @param username
     * @return Admin
     */
    Admin selectByUsername(
            @Param("username") String username);

    /**
     * 更新最后更新时间和ip
     *
     * @param adminId
     * @param ip
     * @param lastLogin
     * @return
     */
    int updateLastLoginById(@Param("adminId") int adminId, @Param("ip") String ip, @Param("lastLogin") long lastLogin);

    int updateByPrimaryKeySelective(Admin record);

    int updateByPrimaryKey(Admin record);

    int backCount(Map qm);

    List<AdminBackDo> backQuery(Map qm);
}